LOCAL_PATH := $(call my-dir)

TARGET_ABILONG := $(TARGET_ARCH)
ifeq ($(TARGET_CPU_ABI), armeabi-v7a)
  TARGET_ABILONG := armv7
endif

ifeq ($(TARGET_CPU_ABI), arm64-v8a)
  TARGET_ABILONG := arm64
endif

ifeq ($(TARGET_CPU_ABI), x86_64)
  TARGET_ABILONG := x64
endif

ifeq ($(TARGET_CPU_ABI), mips64)
  TARGET_ABILONG := mips64
endif

include $(CLEAR_VARS)
LOCAL_MODULE := su
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ABILONG)
LOCAL_SRC_FILES := $(TARGET_ABILONG)/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := supolicy
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ABILONG)
LOCAL_SRC_FILES := $(TARGET_ABILONG)/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := install-su.sh
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := install-recovery.sh
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/common
LOCAL_SRC_FILES := common/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := 99SuperSUDaemon
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/common
LOCAL_SRC_FILES := common/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := chattr.pie
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ABILONG)
LOCAL_SRC_FILES := $(TARGET_ABILONG)/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := libsupol.so
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ABILONG)
LOCAL_SRC_FILES := $(TARGET_ABILONG)/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := Superuser.apk
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/common
LOCAL_SRC_FILES := common/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)